package main

import (
	"fmt"
	"github.com/gin-gonic/gin"
	"img/controller/iplocation"
	"img/core"
	"img/driver"
	"img/global"
	"io"
	"os"
)

func main() {
	core.Viper()
	// Disable Console Color, you don't need console color when writing the logs to file.
	gin.DisableConsoleColor()

	// Logging to a file.
	f, _ := os.Create("gin.log")
	gin.DefaultWriter = io.MultiWriter(f)
	r := gin.Default()
	r.POST("/upload", driver.S3HandleUpload)
	r.GET("/iplocation", iplocation.Get)
	r.Run(fmt.Sprintf(":%d", global.IMG_CONFIG.App.Port)) // listen and serve on 0.0.0.0:8080
}
